# _*_ coding: UTF-8 _*_
# @Time     : 2021/11/3 10:43
# @Author   : 郑鲁明
# @Site     : http://www.hzdledu.cn/
# @File     : unittest结果验证.py
# @Software : PyCharm

import unittest
from selenium import webdriver
import time
from selenium.webdriver.common.by import By


class Test1(unittest.TestCase):

    def setUp(self) -> None:
        self.driver = webdriver.Chrome()
        self.driver.maximize_window()

    def test1(self):
        self.driver.get('https://www.baidu.com/')
        text1 = self.driver.find_element(By.XPATH,'//*[@id="s-top-left"]/a[1]').text

        # assertEqual(预期，实际),验证预期值与实际值是否相等，不等会报错，并且将用例标记为失败
        self.assertEqual('旧闻',text1)


    def tearDown(self) -> None:
        self.driver.quit()
